package com.sca.config;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/*
* 定义请求解析器 ，用于对请求进行解析 sentinel底层在拦截用户请求后，
* 对请求数据进行解析，判定是否符合黑白名单
* 请求http:ip:port /consumer?origin=app1
* */
@Component
public class DefaultRequestOriginParser implements RequestOriginParser {
    @Override
    public String parseOrigin(HttpServletRequest request) {
        return request.getParameter("origin");
    }
}
